<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<meta name="" content=""/>
<title>在这里自由的创建和编辑您的方块！</title>


<link type="text/css" rel="stylesheet" href="http://www.eizia.com/icss/global.css" />
<script type="text/javascript" src="o3djs/base.js"></script>
<script type="text/javascript" src="escript/aba6aa0208aaf918e0395fce0693ec11_backGround.js"></script>
<script type="text/javascript" src="escript/aba6aa0208aaf918e0395fce0693ec11_creator.js"></script>
<script type="text/javascript" src="escript/aba6aa0208aaf918e0395fce0693ec11_dialog.js"></script>
<script type="text/javascript" src="escript/aba6aa0208aaf918e0395fce0693ec11_dialog_kids.js"></script>
<script type="text/javascript" src="escript/aba6aa0208aaf918e0395fce0693ec11_dialog_wov.js"></script>
<script type="text/javascript" src="escript/aba6aa0208aaf918e0395fce0693ec11_listen.js"></script>
<script type="text/javascript" src="escript/aba6aa0208aaf918e0395fce0693ec11_eiziaCube.js"></script>
<script type="text/javascript" src="escript/aba6aa0208aaf918e0395fce0693ec11_menu.js"></script>
<script type="text/javascript" src="escript/aba6aa0208aaf918e0395fce0693ec11_picker.js"></script>
<script type="text/javascript" src="escript/aba6aa0208aaf918e0395fce0693ec11_view.js"></script>
<script type="text/javascript" src="escript/aba6aa0208aaf918e0395fce0693ec11_worker.js"></script>
<script type="text/javascript">



function startLoad(){
	//两层的回调函数，第一步先检查登录状态，等待信息返回后调用加载右边栏HTML的函数，等待加载完成后调用tabs初始化函数。
		init();
	}

function getAJAXObject(){
	var xmlHttp=null;
	try{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
		catch(e){
			// Internet Explorer
			try{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch (e){
						xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
						}
			}
	return xmlHttp;
	}
	
var AJAX_saveModel;
var AJAX_loadModel;
var capSrc;

function saveToServer(string,name,description){
	
	AJAX_saveModel = getAJAXObject();
	if(AJAX_saveModel==null){
		alert ("Browser does not support HTTP Request");
		return;
		}
		
	capSrc = cubeClient.toDataURL("image/png");
	capSrc = capSrc.slice(22);
	capSrc = capSrc.replace(/\+/g,"%2B");
		
		
	var url="createModelPage.php"
	url = url +"?sid="+Math.random();
	AJAX_saveModel.open("POST",url,true);
	//AJAX_saveModel.onreadystatechange = savedTips;	
	AJAX_saveModel.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf8");
	AJAX_saveModel.send("state=saveModel&"+
						"stringData="+string+"&"+
						"captureData="+capSrc+"&"+
						"description="+description+"&"+
						"name="+name
						);
	
	}
	
function savedTips(){
	if (AJAX_saveModel.readyState==4 || AJAX_saveModel.readyState=="complete")
		{ 
		var xmlDoc = AJAX_saveModel.responseXML;
		var saveModel = xmlDoc.getElementsByTagName("saveModel");
		var info = saveModel[0] ? saveModel[0].childNodes[0] : false;
		if(info){
			//document.getElementById("saveInfo").innerHTML = info.childNodes[0].nodeValue;
			}
		} 
	}

function wantSave(){
	document.getElementById("cubeTitleButton").style.display = "none";
	document.getElementById("cubeInformation").style.display = "";
	
	var o3dDiv = document.getElementById("o3d");
	o3dDiv.style.width = "640px";
	o3dDiv.style.height = "340px";
	setTimeout(function(){resizeClient();},50);
	
	mouseMode = false;
	document.getElementById("cubeInformationForm").cubeData.value = 
							worker.save(cubeSelect[cubeSelect.length-1]);
	menu.cancel();
//////////////////要加上取消所有场景中的对话框///////////////
	}
	
function cancelSave(){
	document.getElementById("cubeTitleButton").style.display="";
	document.getElementById("cubeInformation").style.display = "none";
	
	var o3dDiv = document.getElementById("o3d");
	o3dDiv.style.width = "960px";
	o3dDiv.style.height = "510px";
	setTimeout(function(){resizeClient();},50);
	mouseMode = true;
	}
</script>

<style type="text/css">
<!--
#o3d{
	width: 960px;
	height: 510px;
}
#cubeTitle  {
	height:30px;
	}
#cubeTitleName span{
	float:left;
	height:30px;
	font-family: "微软雅黑", Verdana, Tahoma;
	font-size: 20px;
	}
#dataForm {
	position: absolute;
	top:500px;
	left:300px;
}

-->
</style>
</head>
 
<body id="body" onload="startLoad();">
<div id="content" >
    <div id="content_title">
        <a href="http://www.eizia.com/home.html" id="logo-container">
          <h1 id="logo">
             <span>eizia,自由创造与分享！</span>
          </h1>
        </a>
        <div id="content_line"></div>
    </div>
        <div id="cubeTitle">
            <div id="cubeTitleName"><span>创建新模型</span></div>
            <div id="cubeTitleButton"  style="float:right">
            <a href="#" class="button_a_80" onclick="wantSave()"><span>立即保存</span></a>
            </div>
    	</div>
    <div id="o3d"></div>
    <div id="cubeInformation" style="display:none">
        <form id="cubeInformationForm">
        <table>
        <tbody>
        <tr>
        	<td align="right" width="90px">作品名称:</td>
            <td><input type="text" name="modelName" size="20"/></td>
        </tr>
        <tr>
        	<td align="right">作品描述:</td>
            <td><textarea  name="modelDescription" rows="4" cols="81" ></textarea></td>
        </tr>
       	<tr>
            <td><a href="#" class="button_a_100" 
                    onclick="saveToServer(document.getElementById('cubeInformationForm').cubeData.value,
                    					document.getElementById('cubeInformationForm').modelName.value,
                    					document.getElementById('cubeInformationForm').modelDescription.value)
                                        "><span>确定保存</span></a></td>
            <td><a href="#" class="button_a_100" onclick="cancelSave()"><span>返回修改</span></a></td>
         </tr>
         <tr>
             <td>
             <textarea name="cubeData" style="display:none" cols="0" rows="0"></textarea>
             </td>
         </tr>
        </tbody>
        </table>
        </form> 
    </div>
  </div>
<div id="userTabs"></div>
<div id="clear"></div>
</body>
</html>
